using Brilliance;
using Brilliance.navigation;

using SampleApplication.model;
using SampleApplication.view;

namespace SampleApplication.presenter
{
    public class SucceedLoginAction : INavigateAction
    {
        public IPresenter[] Navigate(IViewFactory viewFactory, IPresenterFactory presenterFactory, Request request)
        {
            viewFactory.CloseAllExceptView(typeof (DashboardView));
            IDashboardView dashboardView = viewFactory.GetView<DashboardView>();
            IDashboardPresenter dashboardPresenter = presenterFactory.Create<DashboardPresenter, IDashboardView>(dashboardView);
            dashboardPresenter.Principal = request.Get<Principal>();
            return new[] {dashboardPresenter};
        }
    }
}